﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace EggHarvest.GraphicsSupport
{
    public class Egg:TexturedPrimitive
    {
        private Vector2 mDeltaPosition; //Change current position by this amount
        Vector2 kInitSize = new Vector2(5,5);

        public Egg() : base("egg")
        {
            mPosition = Camera.RandomPosition();
            mSize = kInitSize;
            
        }

        public Egg(Vector2 position, float diameter): base("egg", position, new Vector2(diameter, diameter))
        {
            mDeltaPosition.X = (float) (Game1.sRan.NextDouble()) * 2f - 1f;
            mDeltaPosition.Y = (float) (Game1.sRan.NextDouble()) * 2f - 1f;
        }

        public float Radius
        {
            get { return mSize.X*0.5f; }
            set
            {
                mSize.X = 2f*value;
                mSize.Y = mSize.X;
            }
        }

      

        public override void Fall()
        {
            float speed = 0.00000000001f;
            if (Game1.score>10)
            {
                speed =(float) (Game1.score / 20 * 0.09) ;
            }
            
            mDeltaPosition.X = 0;
            mDeltaPosition.Y = -0.4f + (-speed);
            Position += mDeltaPosition;
        }
    }
}
